﻿@model B4Deal.Models.TAIKHOAN
@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="@Url.Content("~/Content/Layout/payment.css")" rel="stylesheet" type="text/css" />
<script type="text/javascript">
    function setUrl(tit, val) {
        var url = "http://sandbox.nganluong.vn/button_payment.php?receiver=trongnghia09ctt2@gmail.com";
            url += "&product_name=" + tit.toString();
            url += "&price=" + val.toString();
            url += "&return_url=" + "www.b4deal.somee.com";
            url += "&comments=" + "Khong co gi";
            return url;
    };
    function NLPayment() {
            var title = "";
            var value = ""; 
            $.ajax({
                url: '@Url.Action("GetDealFromCart")',
                type: "POST",
                data: null,
                async: false,
                success: function (data) {
                    if (data.rs == "success") {
                        title = data.tt.toString();
                        value = data.val.toString();                                                            
                    }                     
                }
            });
            
            return setUrl(title, value);        
    };
    $(document).ready(function () {
        var UrlNL = NLPayment();        
        $('#aPTTT_1').click(function () {
            $('#aPTTT_1 i').addClass('checked');
            $('#aPTTT_0 i').removeClass('checked');
            $('#PTTT').val("1");               
            var bt = document.getElementById("btnTT_0");
            bt.setAttribute('href',UrlNL);
        });
        $('#aPTTT_0').click(function () {
            $('#aPTTT_0 i').addClass('checked');
            $('#aPTTT_1 i').removeClass('checked');
            $('#PTTT').val("0");       
            var bt = document.getElementById("btnTT_0");
            bt.setAttribute('href',"@Url.Action("Thank", new { id = 1 })");
        });
        $('#btnTT_0').click(function () {
            $("#errorpayment").html("");
            $.ajax({
                url: '@Url.Action("AddOrder")',
                type: "POST",
                data: $("#paymentForm").serialize(),
                async: false,
                success: function (data) {
                    if (data.result == "success") {
                        $("#errorpayment").html("<span>Lưu thông tin thành công!</span>");                        
                        
                    }
                    else {
                        $("#errorpayment").html("<span>" + data.result + "</span>");
                    }
                }
            });
        });
    });
</script>
<div class="middle-box-white" style="overflow: hidden;">
    <div class="payment">
        <i class="title_order" style="font-style: normal">Chọn phương thức thanh toán</i>
        <p id="errorpayment" class="validation-summary-errors" style="margin-top: 20px;">
        </p>
        <form id="paymentForm">
        <ul class="payment_content">
            <input name="PTTT" type="text" id="PTTT" value="0" style="display: none">
            <li class="icon_home"><a href="javascript:void(0);" name="" id="aPTTT_0"><i class="checkbtn  checked">
            </i><span class="img_payment "></span></a></li>
            <li class="icon_payoo" style="position: relative"><a href="javascript:void(0)" name=""
                id="aPTTT_1"><i class="checkbtn"></i><span class="img_payment"></span></a></li>
            <li class="box_payment " id="liPTTT_0" style="display: block;">
                <ul class="box_payment_content">
                    <li class="textbox">
                        <div class="bg_txtb">
                            <input name="txtEmail_0" type="text" id="txtEmail_0" value="@Model.Email"></div>
                        <i>*</i> <span>Email nhận</span> </li>
                    <li class="textbox">
                        <div class="bg_txtb">
                            <input name="txtName_0" type="text" id="txtName_0" value="@Model.HoTen"></div>
                        <i>*</i> <span>Họ và tên</span> </li>
                    <li class="textbox">
                        <div class="bg_txtb">
                            <input name="txtPhone_0" type="text" id="txtPhone_0" value="@Model.DienThoai"></div>
                        <i>*</i> <span>Điện thoại</span> </li>
                    <li class="textbox bg_add">
                        <ul class="box_payment_content">
                            <li class="textbox">
                                <div class="bg_txtb street">
                                    <input name="txtDuong_0" type="text" id="txtDuong_0" value="Hồ Văn Tư"></div>
                                <i>*</i> <span>Đường</span> </li>
                            <li class="textbox num_home">
                                <div class="bg_txtb number">
                                    <input name="txtSoNha_0" type="text" id="txtSoNha_0" value="132"></div>
                                <i>*</i> <span>Số nhà</span> </li>
                            <li id="liWard_0" class="textbox ">
                                <div class="bg_txtb">
                                    <input name="txtWard_0" type="text" id="txtWard_0" value="Trường Thọ"></div>
                                <i>*</i> <span>Phường</span> </li>
                            <li id="dQuan_0" class="textbox">
                                <div class="bg_txtb">
                                    <input name="txtQuan_0" type="text" id="txtQuan_0" value="Thủ Đức">
                                </div>
                                <i>*</i> <span>Quận</span> </li>
                            <li class="textbox">
                                <div class="bg_txtb">
                                    <input name="txtBuilding_0" type="text" id="txtBuilding_0" value="số 6">
                                </div>
                                <i style="color: #BFCDD6;">*</i> <span>Toà nhà</span> </li>
                            <li id="dChangePosition" class="textbox"><a href="http://www.nhommua.com/can-tho/Profile/Location.aspx?CityID=710&sp=7F050906007C&Address=0"
                                id="aChangePos_0" class="btn_change_add"></a></li>
                        </ul>
                    </li>
                    <li class="textbox" style="padding: 0"><span style="line-height: 24px; float: left;
                        width: 79px; text-align: right;">Lời nhắn</span>
                        <div class="bg_txtb textarea" style="width: auto; margin: 0;">
                            <textarea name="txtDesc_0" id="txtDesc_0" style="width: 528px;" cols="8" rows="2"></textarea></div>
                    </li>
                    <li class="textbox request">
                        <ul class="info_line">
                            <li id="dConfirm_0" style="display: none;"><span>Tôi không cần B4Deal gọi điện xác nhận.</span>
                            </li>
                            <li id="dSubScribe_0" style="display: none;">
                                <input name="cbSubScribe_0" type="checkbox" id="cbSubScribe_0">
                                <span>Tôi đồng ý nhận thông báo Deals hấp dẫn mỗi ngày qua Email</span> </li>
                        </ul>
                    </li>
                    <li class="textbox"><a class="btn_mua_small" href="@Url.Action("Thank", new { id = 1 })" name="" id="btnTT_0">
                    </a><span id="eMess_0" class="payment-note"></span></li>
                </ul>
            </li>
        </ul>
        </form>
    </div>
</div>
